package com.bytezero.mapper;

import com.bytezero.bean.Emp;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

/**
 * @Author: Bytezero_zhengLei
 * @Date: 2024/6/30 9:11
 * @Project_Name:
 * @Email: 420498246@qq.com
 * @Description:
 * @TODO:
 */
@Mapper
public interface EmpMapper {

    //增
    @Insert("insert into emp(username,name,gender,image,job,entrydate,dept_id,create_time,update_time)" + " values(#{username},#{name},#{gender},#{image},#{job},#{entrydate},#{deptId},#{createTime},#{updateTime})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    public abstract void UpdateData(Emp emp);

    //删
    @Delete("delete from emp where id = #{id}")
    public abstract void deleteEmpId(Integer id);

    //改
    @Update("update emp set name = #{name},job = #{job} where id= #{id}")
    public abstract void updateEmp(Emp emp);

    //查
    @Select("select * from emp where id =#{id}")
    public abstract Emp selectEmpById(@Param("id") Integer id);

    //关联 xml文件
    public abstract List<Emp> selectAllEmp();

    //条件查询
    public abstract List<Emp> conditionSelect(
            @Param("name")String name,
            @Param("gender") Integer gender,
            @Param("startTime")LocalDate startTime,
            @Param("endTime") LocalDate endTime
            );
//    public abstract List<Emp> conditionSelect(
//            String name,
//          Integer gender, LocalDate startTime,
//       LocalDate endTime
//    );

     //修改员工
    public abstract void updateEmp2(Emp emp);


    void deleteIds(@Param("ids") List<Integer> ids);
}
